package smartcampus.scjava.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import smartcampus.scjava.POJO.DO.Student;
import smartcampus.scjava.custom.ResultVO;
import smartcampus.scjava.mapper.StudentMapper;
import smartcampus.scjava.service.StudentService;

import java.util.List;

/**
 * @author 苟森
 * @description 针对表【student(学生个人信息表)】的数据库操作Service实现
 * @createDate 2023-11-26 15:57:16
 */
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student>
        implements StudentService {
    @Autowired
    StudentMapper studentMapper;

    @Override
    public Boolean delByStuId(String stuid) {
        return studentMapper.deleteBystuId(stuid);

    }

    @Override
    public Boolean insertByStuid(Student student) {
        int a = studentMapper.insert(student);
        if(a!=0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public Boolean selectByStuid(String stuid) {
        return studentMapper.selectByStuid(stuid);
    }

    @Override
    public List<Student> findAll() {
        QueryWrapper<Student> queryWrapper = new QueryWrapper<Student>();
        queryWrapper.eq("is_delete", 0);
        return studentMapper.selectList(queryWrapper);
    }
}




